// app.js
App({
  onLaunch() {
    wx.clearStorageSync();
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)
    // 获取用户在小程序中的唯一id
    wx.login({
      success: res => {
        // console.log(res)
        var code = res.code;
        wx.request({
          url: 'https://api.weixin.qq.com/sns/jscode2session?appid=wx76d1c19d8eb39154&secret=4a9bcd935bc45c8c9ee38ed461e9e56c&js_code=' +
          code + '&grant_type=authorization_code',
          method:'GET',
          success: res =>{
            // console.log(res)
            wx.setStorageSync('userid', res.data.openid)
          },
          fail: err =>{
            wx.showToast({
              title: '微信登录失败',
              icon:'error'
            })
          }
        })
      }
    })
  },
  globalData: {
    userInfo: null,
    myorderlist:[],
    ordertime:"",
    result: "",
    qu: "",
    sheng: "",
    shi: "",
    latitude: "",
    longitude: "",
    time:""
  }
})
